package chapter14.nullperson;

/**
 * @author : DuJiabao
 * @Date : 2021/2/25 16:31
 * @Project : thinking_in_java
 * @File : null.java
 * @Desc :
 */
public class Person {
  public final String first;
  public final String last;
  public final String address;

  public Person(String first, String last, String address) {
    this.first = first;
    this.last = last;
    this.address = address;
  }

  @Override
  public String toString() {
    return "Person{" +
            "first='" + first + '\'' +
            ", last='" + last + '\'' +
            ", address='" + address + '\'' +
            '}';
  }

  /**
   * 空对象
   */
  public static class NullPerson extends Person implements Null {
    public NullPerson() {
      super("None", "None", "None");
    }

    @Override
    public String toString() {
      return "NullPerson";
    }
  }
  public static final Person NULL = new NullPerson();
}
